package bingo.common.exeception;

import java.util.Locale;

import net.bingosoft.common.ObjectRegistry;

/**
 * Jul 10, 2008 1:49:29 PM
 * Author:yangdongyu(yangdy@bingosoft.net)
 * ReadMe:本地化的异常,为异常的国际化设计
 * ChangeLog:
 */
public class LocalizedExeception extends RuntimeException {
	private static final long serialVersionUID = 1L;
	private String detailMessage ;
	
	public LocalizedExeception(Throwable cause) {
		super(cause);
	}
	
	public LocalizedExeception(Locale locale,String messageKey) {
		this.detailMessage = ObjectRegistry.getLocaleMessage(locale, messageKey);
	}
	
	public LocalizedExeception(Locale locale,String messageKey,Throwable cause) {
		super(cause);
		this.detailMessage = ObjectRegistry.getLocaleMessage(locale, messageKey);
	}
	
	public LocalizedExeception(Locale locale,String messageKey,String[] args) {
		this.detailMessage = ObjectRegistry.getLocaleMessage(locale, messageKey, args);
	}

	@Override
	public String getLocalizedMessage() {
		return detailMessage;
	}

	@Override
	public String getMessage() {
		return detailMessage;
	}
	
}
